
<div class="box box-primary">
	
	<div class="box-body">
		<!-- the events -->
		<div id="external-events">
                <div class="row">
                    <div class="col-xs-12">
                   
			<?php
                            if($job_details){
                                if($job_details !=null ){
                                    foreach($job_details->result() as $row):
                                        $job_title   = $row->job_title;
                                        $job_term = $row->job_term;
            ?>
                <h4 class="box_content"><?php echo $row->job_title; ?></h4>
            <?php
                                        $job_created = $row->job_created;
                                        $level = $row->level;
                                        $location = $row->location;
                                        $job_term = $row->job_term;
                                        $job_type = $row->job_type;
                                        $salary = $row->job_salary;
                                        $hiring = $row->job_hiring;
                                        $age = $row->age;
                                        $create_date = $row->create_date;
                                        $data_avaliable = $row->date_available;
                                        $gender = $row->gender;
                                        $description = $row->job_description;
                                        $contact_name = $row->contact_name;
                                        $contact_phone = $row->contact_phone;
                                        $contact_email = $row->contact_email;
                                        $requirements = $row->job_requirements;
                                        $company_name = $row->company_name;
                                        $company_phone = $row->company_phone ;
                                        $company_fax = $row->company_fax ;
                                        $company_website =  $row->company_website;
                                        $company_logo = $row->company_logo;
										$company_address = $row->address;
										$company_description =$row->company_description;
										$job_by = $row->posted_by;
										$company_key = $row->company_key;
										if($company_logo==NULL || $company_logo ==""){
            								$logo_img = base_url().F_IMG.'nologo.jpg';
								        }else{
								            $logo_img = base_url().F_IMG.'employer_logo/'.$company_logo;
								        }
										
										
                                    endforeach;
                                }
                            }
                        ?>
                        
                        <div class="contain-image-logo">
                            <img class="image-logo" src="<?php echo $logo_img; ?>" /> 
                        </div>
                         <div class="company_info">
                            
                            <table>
                                <tr>
                                    <th>Campany</th>
                                    <td><?php echo $company_name; ?></td>
                                </tr>
                                <tr>
                                    <th>Website</th>
                                    <td><a href="http://www.<?php echo $company_website; ?>" target="_blank"><?php echo $company_website; ?></a></td>
                                </tr>
                                <tr>
                                    <th>Phone</th>
                                    <td><?php echo $company_phone; ?></td>
                                </tr>
                                <tr>
                                    <th>Fax</th>
                                    <td><?php echo $company_fax; ?></td>
                                </tr>
                                <tr>
                                    <th>Adress</th>
                                    <td><?php echo $company_address; ?></td>
                                </tr>
                            </table>
                            
                        </div>
                        
                        <table class="table table-striped table-bordered bootstrap-datatable" cellspacing="0" cellpadding="0" border="0">
                            <tbody>
                                <tr>
                                    <th>
                                        Level
                                	</th>
                                	<td ><?php echo $level; ?></td>
	                                <th>
	                                    Term
	                                </th>
	                                <td><?php echo $job_term; ?></td>
                                </tr>
                                
                                <tr>
                                    <th>
                                       Hiring
                                	</th>
                                <td><?php echo $hiring; ?></td>
                                <th>
                                   Sex
                                </th>
                                <td><?php echo $gender; ?></td>
                                </tr>
                                
                                 <tr>
                                    <th>
                                        Salary ($)
                                </th>
                                <td style="font-weight: bold;"><?php echo $salary; ?></td>
                                <th>
                                    Age
                                </th>
                                <td><?php echo $age; ?></td>
                                </tr>
                                
                                <tr>
                                    <th>
                                        Type
                                </th>
                                <td><?php echo $job_type; ?></td>
                                <th>
                                    Location
                                </th>
                                <td><?php echo $location; ?></td>
                                </tr>
                                
                                <tr>
                                <th>
                                     Publish date
                                </th>
                                <td ><?php echo date('d-M-Y',strtotime($job_created)); ?></td>
                                <th>
                                    Avaliable Date
                                </th>
                                <td style="color: red; font-weight: bold;"><?php echo date('d-M-Y',strtotime($data_avaliable)); ?></td>
                                </tr>
                            </tbody>
                        </table>
                    </table>
                    <div id="herobox-mini" style="border:none;">
                        <ul id="glbreadcrumbs-one">
                            <li>
                                <a href="#">Description</a>
                            </li>
                        </ul>
                    </div>
                    <div class="job_description">
                        <p>
                            <?php echo $description; ?>
                        </p>
                    </div>
                     <div id="herobox-mini" style="border:none;">
                        <ul id="glbreadcrumbs-one">
                            <li>
                                <a href="#">Requirement</a>
                            </li>
                        </ul>
                    </div>
                    <div class="job_requirement">
                        <p>
                            <?php echo $requirements; ?>
                        </p>
                    </div>
                    <div id="herobox-mini" style="border:none;">
                        <ul id="glbreadcrumbs-one">
                            <li>
                                <a href="#">Contact Person</a>
                            </li>
                        </ul>
                    </div>
                    <div class="">
                       
                       <div class="company_info" style="width:300px;">
                            <table>
                                <tr>
                                    <th>Name</th>
                                    <td><?php echo $contact_name; ?></td>
                                </tr>
                                <tr>
                                    <th>Phone</th>
                                    <td><?php echo $contact_phone; ?></td>
                                </tr>
                                <tr>
                                    <th>E-mail</th>
                                    <td><?php echo $contact_email; ?></td>
                                </tr>
                            </table>
                        </div>
                    </div>
                        <div class="contain-social">
                            <div class="fb-like pull-left" data-href="<?php echo base_url(); ?>jobs/detail/<?php echo $this->uri->segment(3); ?>" data-layout="button_count" data-action="like" data-show-faces="false" data-share="true"></div>
                        </div>
                        <div class="btn-reply">
                        	<?php
                        		if($job_by=="employer"){
                        	?>
                        			<a href="<?php echo base_url().'jobs/add-to-favorite/'.$this->uri->segment(3); ?>" class="btn btn-warning  btn-sm"><span class="glyphicon glyphicon-star"></span> Favorite</a>
                        			<a href="<?php echo base_url().'jobs/apply-job-online/'.$this->uri->segment(3); ?>" class="btn btn-primary btn-sm"><span class="glyphicon glyphicon-share-alt"></span> Apply Job </a>
                        			
                        	<?php
                        		}else{
                        	?>
                        			<a href="<?php echo base_url().'jobs/add_favorite/'.$this->uri->segment(3); ?>" class="btn btn-warning  btn-sm"><span class="glyphicon glyphicon-star"></span> Favorite </a>
                        			
                        	<?php
                        		}
                        	?>
                        
                       </div>
                        </div><!-- /.box-body -->
	</div>
     </div>
                </div>
</div><!-- /. end facebook fan page -->


<div class="box box-primary">
	<div class="box-body">
		<!-- the events -->
		<div id="external-events">
                <div class="row">
                    <div class="col-xs-12">
                        <h4 class="box_content">Send this offer to a friend</h4>
                    <div id="respond_result"></div>
                    <div class="job_description" style="width: 400px;">
                        <form role="form" id="sendJob" action="<?php echo base_url(); ?>jobs/send_email_to_friend" method="post">
                                    <div class="">
                                        
									    <div class="form-group">
									        <label>Your Friend Email Address</label>
									        <input type="text" class="form-control" name="email" />
									    </div>
									    <div class="form-group">
									        <label>User Name</label>
									        <input type="text" class="form-control" name="username" />
									    </div>
									    
									    <div class="form-group">
									        <label id="captchaOperation"></label>
									        <input type="text" class="form-control" name="captcha" />
									    </div>
									            <button type="submit" class="btn btn-primary">Send</button>
									    <input type="hidden" name="job_key" value="<?php echo $this->uri->segment(3); ?>" />
                                    </div>
                                <div class="image_loading" style="display: none;"><img src="<?php echo base_url() . F_IMG; ?>loading.gif"></div>
                        </form>
	
                        <!-- end formvalidation test -->
                    </div>
                    </div>
                </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    function setEmpty(){
      $("#email").val('');$("#username").val('');$("#mathquestion").val('');
    }
    function refresh_page() {
    	location.reload();
    };

$(document).ready(function() {
    function randomNumber(min, max) {
        return Math.floor(Math.random() * (max - min + 1) + min);
    };

    function generateCaptcha() {
        $('#captchaOperation').html([randomNumber(1, 100), '+', randomNumber(1, 100), '= ?'].join(' '));
    };

    generateCaptcha();

    $('#sendJob')
        .bootstrapValidator({
            // feedbackIcons: {
                // valid: 'glyphicon glyphicon-ok',
                // invalid: 'glyphicon glyphicon-remove',
                // validating: 'glyphicon glyphicon-refresh'
            // },
            fields: {
            	email: {
                validators: {
                    notEmpty: {
                        message: 'The email address is required'
                    },
                    emailAddress: {
                        message: 'The email address is not valid'
                    }
                }
            },
            	username: {
                    validators: {
                        notEmpty: {
                            message: 'The name is required'
                        }
                    }
                },
                captcha: {
                    validators: {
                        callback: {
                            message: 'Wrong answer',
                            callback: function (value, validator, $field) {
                                // Determine the numbers which are generated in captchaOperation
                                var items = $('#captchaOperation').html().split(' '),
                                    sum   = parseInt(items[0]) + parseInt(items[2]);
                                return value == sum;
                            }
                        }
                    }
                }
            }
        })
        .on('error.form.bv', function (e) {
            generateCaptcha();
        });
});


</script>
<!-- Facbooke script -->
<div id="fb-root"></div>
<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&appId=1382635978667510&version=v2.0";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>